<!--div id="loader" class="container"-->
	<div class="col-md-offset-1">
    <form method="post" id="formuser" action="#" enctype="multipart/form-data" class="form-horizontal" role="form">
        <div class="col-md-11">
			<div class="panel-body well">
				<h4><b class="caret"></b><b> Form - Edit Master Item</b></h4>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="l_item" class="control-label">Item Name<span style="color:red;">*</span></label></div>
					<div class="col-sm-4"><input type="text" class="form-control input-sm required" id="item" name="item" value="<?php echo $list_data['ITEM_PUBLIC_ROOM_NAME'] ?>" disabled></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="l_quantity" class="control-label">Item Qty<span style="color:red;">*</span></label></div>
					<div class="col-sm-3"><input type="text" class="form-control input-sm required" id="quantity" name="quantity" value="<?php echo $list_data['ITEM_PUBLIC_ROOM_QTY'] ?>"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="l_uom" class="control-label">Item Uom</label></div>
					<div class="col-sm-3"><input type="text" class="form-control input-sm" id="uom" name="uom" value="<?php echo $list_data['ITEM_PUBLIC_ROOM_UOM'] ?>"></div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="l_status" class="control-label">Item Status</label></div>
					<div class="col-sm-3">
						<select name="status" id="status" class="form-control input-sm">
							<option value="Y"<?php echo (strtoupper($list_data['ITEM_PUBLIC_ROOM_STATUS']) == 'Y') ? 'selected' : ''; ?>>Active</option>
                            <option value="N"<?php echo (strtoupper($list_data['ITEM_PUBLIC_ROOM_STATUS']) != 'Y') ? 'selected' : ''; ?>>Non Active</option>
						</select>
					</div>
				</div>			
				<div class="col-sm-8" style="padding-bottom: 10px;">
					<div class="col-sm-4">
						&nbsp;
					</div>
				</div>
				<div class="col-sm-8">
					<div class="col-sm-4"><label for="button" class="control-label">&nbsp;</label></div>
					<div class="col-sm-4">
						<?php
							$public_room_id = $list_data["ITEM_PUBLIC_ROOM_ID"];									                                
						?>
						<button type="button" class="btn btn-success btn-block" onclick="save('<?php echo $public_room_id ?>');" >
						<!--span class="glyphicon glyphicon-saved"></span--> Save Edit</button>
					</div>
					<div class="col-sm-4">
						<button type="button" class="btn btn-default btn-block" onclick="cancel();">
						<!--span class="glyphicon glyphicon-circle-arrow-left"></span--> Cancel</button>
					</div>
				</div>
			</div>
		</div>
    </form>
	</div>
<!--/div-->

<script type="text/javascript">
    function cancel() {
        $.post("<?= site_url() ?>setup/view_master_item", function(data) {
            $('#loader').html(data);
        });
    }
	
	function save(public_room_id) {
        $.post("<?= site_url() ?>setup/edit_master_item", {
			public_room_id: public_room_id, 
			item: $('#item').val(),
			quantity: $('#quantity').val(),
			uom: $('#uom').val(),
			status: $('#status').val()	
		}, 
		function(data) {
            $('#loader').html(data);
        });
    }
</script>